/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.dao;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.expert.entity.StoreCustomerNotify;

/**
 * 客户产品护理提醒DAO接口
 * @author liujiang
 * @version 2014-02-19
 */
public interface StoreCustomerNotifyDao extends StoreCustomerNotifyDaoCustom, CrudRepository<StoreCustomerNotify, Long> {
	@Query("from StoreCustomerNotify where STORE_ID = ?1 AND NOTIFY_DATE BETWEEN ?2 AND ?3")
	public List<StoreCustomerNotify> findByParameter(Long storeId, Date start, Date end);
	
	@Query("SELECT SUM(CEIL(CHAR_LENGTH(CONTENT)/?1)) from StoreCustomerNotify where STORE_ID = ?2 AND NOTIFY_DATE BETWEEN ?3 AND ?4")
	public Long countByParameter(long defaultLength, Long storeId, Date start, Date end);
	
}

/**
 * DAO自定义接口
 * @author liujiang
 */
interface StoreCustomerNotifyDaoCustom extends BaseDao<StoreCustomerNotify> {

}

/**
 * DAO自定义接口实现
 * @author liujiang
 */
@Component
class StoreCustomerNotifyDaoImpl extends BaseDaoImpl<StoreCustomerNotify> implements StoreCustomerNotifyDaoCustom {

}
